export default {
  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: '咪乐多',
    htmlAttrs: {
      lang: 'zh'
    },
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },
  generate:{
    fallback:true,
    interval:150
  },
  router:{
    middleware:'auth',
    extendRoutes(routes,resolve){
      routes.push({
        name:'home',
        path:'/index',
        component:resolve(__dirname,'pages/index.vue')
      })
      // console.log(routes)
    }
  },
  // 可以设置loading 也可以指定自己的组件
    loading: {
      color: '#1A1E5D',
      height: '2px'
    },
    // loading: '~/components/loading/loading.vue',
  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
    'element-ui/lib/theme-chalk/index.css',
    'element-ui/lib/theme-chalk/display.css',
    './assets/css/base.css',
    './assets/icon/iconfont.css'
  ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    {
      src: '~/plugins/axios',
      ssr: true // 开启服务端渲染
    },
    {
      src: '~/plugins/element-ui',
      ssr: true,
      // mode: 'server' // or client // v2.4+
    },
    {
      src: '~/plugins/vue-particles',
      ssr: false // 开启服务端渲染
    }
  ],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
    '@nuxt/typescript-build'
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    '@nuxtjs/axios',
    '@nuxtjs/proxy',
    '@nuxtjs/style-resources'
  ],
  styleResources: { // 需要添加这个 用来配置全局
    scss: [
      './assets/scss/config.scss'
    ]
  },
  axios: {
    proxy: true, // 开启跨域行为
    // baseUrl: 'https://server.lvacms.cn/api/v1/', //baseUrl
  },
  proxy: { // 代理
    '/api/': {
      target: 'https://server.lvacms.cn', //代理转发地址
      changeOrigin: true,
      pathRewrite: {
        // '^/api': ''
      }
    }
  },
  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    transpile: [/^element-ui/]
  }
}
